<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <title>找回密码
        <!--{$site.title}-->_
        <!--{$site.seotitle}-->
    </title>
    <meta name="keywords" content="<!--{$site.keywords}-->" />
    <meta name="description" content="<!--{$site.description}-->" />
    <!--{iCMS:public:ui}-->
    <link rel="stylesheet" href="<!--{$site.urls.tpl}-->/static/css/user.css" type="text/css" />
    <script>
    $(function() {
        var findpwd = $("#findpwd-box");
        $("#findpwd-submit").click(function(event) {
            event.preventDefault();
            $(".tip-error").hide();
            var param = {
                uname: $("#uname", findpwd).val(),
                seccode: $("#seccode", findpwd).val()
            }

            if (!param.uname) {
                tip({
                    forward: 'uname',
                    msg: '请填写您注册时所用的邮箱！'
                });
                return false
            }
            var pattern = /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9._-])+/;
            if (!pattern.test(param.uname)) {
                tip({
                    forward: 'uname',
                    msg: '电子邮箱格式不正确！'
                });
                return false;
            }
            if (param.seccode == "") {
                tip({
                    forward: 'seccode',
                    msg: '请输入验证码'
                });
                return false
            }
            //找回密码接口
            iCMS.run('passport', function($PASSPORT) {
                //成功 事件绑定
                $PASSPORT.SUCCESS = function(s) {
                    iCMS.UI.alert(s.msg);
                }
                //失败 事件绑定
                $PASSPORT.FAIL = function(f) {
                    tip(f);
                }
                //提交参数
                $PASSPORT.FINDPWD(param);
            });
        });
        //提示
        function tip(ret) {
            iCMS.UI.seccode(".seccode-img", findpwd);
            var tip = $('.tip-' + ret.forward);
            tip.text(ret.msg).show();
        }
    })
    </script>
</head>

<body class="userApp passport">
    <!--{include file="./user.header.htm" import="true"}-->
    <div class="container">
        <div id="findpwd-box" class="wrapper">
            <div class="logo">
                <a href="<!--{$site.url}-->">
                    <img src="<!--{$site.urls.tpl}-->/static/img/iCMS.LOGO.png" />
                </a>
            </div>
            <div class="form-group">
                <label for="uname" class="control-label">邮箱：</label>
                <input type="text" name="uname" class="form-control" id="uname" placeholder="请填写你注册时所用的邮箱">
                <p class="help-block tip-error tip-uname tip-mail">请填写你注册时所用的邮箱</p>
            </div>
            <div class="form-group seccode-wrap">
                <label for="seccode">验证码</label>
                <input type="text" id="seccode" name="seccode" class="form-control" placeholder="验证码" />
                <!--{iCMS:public:seccode}-->
                <p class="help-block tip-error tip-seccode">请输入图片中的字符!</p>
            </div>
            <div class="clearfix mt10">
                <button type="submit" id="findpwd-submit" class="btn btn-primary btn-lg btn-block">提 交</button>
            </div>
            <div class="clearfix mt10">
                <a class="btn btn-success" href="<!--{iCMS:router url='user:register'}-->">
                    <i class="fa fa-user"></i> 我没有账号？去注册 »
                </a>
            </div>
        </div>
    </div>
    <div class="clearfix mt10"></div>
    <!--{include file="iCMS://footer.htm"}-->
</body>

</html>
